<template>
  <div class="container-pt">
    <van-nav-bar left-arrow @click-left="$router.back()" fixed title="我的收藏" />
    <article-list :disable-swiper="false" :articles="mycollect">
      <template #rights="{id}">
        <van-button square type="warning" text="取消" @click="cancel(id)" />
      </template>
    </article-list>
  </div>
</template>

<script>
import articleList from '@/components/article-list.vue'
import { getmycollect } from '../../api/userinfo'
import { cancelit } from '../../api/cancel';
export default {
  components: { articleList },
  data () {
    return {
      active: 0,
      params: {
        type: 1,
        page: 1,
        limit: 10
      },
      mycollect: []
    };
  },
 
  methods: {
    async docollect () {
      const res = await getmycollect(this.params)
      console.log(res);
      this.mycollect = res.data.list.data
    },
    async cancel (id) {
      console.log(id);
      const params = {
        type: 1,
        action: 'del',
        article_id: id
      }
      const res = await cancelit(params)
      console.log(res);
      if (res.errno === 0) {
        this.$toast.success('取消成功')
      }
      this.$router.go(0)
    }
  }
};
</script>

<style>
</style>